{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Post-retirement Plan"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.Pension Plan\n",
    "2.Medical insurance/Life insurance"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.Defined-contribution pension plan(DC): contribution made by employers are defined. Future value is unknown."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.Defined-benefit pension plan (DB):employers promises to pay a certain annual amount to employee after retirement."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdQAAAEWCAYAAADfB2bTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAHEhJREFUeJzt3Xl0VeX5t/HvDSRkApEpIYAIMkvBMg+VarEqokRtBQRBlODYaiksBbUvuii6pICy0KoIYfJHqyCtlApWsA4ICI5QBUqDIIhYUSZBQoD7/eOcxCQkIeCDJ9jrs1aWOXvvs59n77i4sndOcszdBQAAvpsKsZ4AAAA/BAQVAIAACCoAAAEQVAAAAiCoAAAEQFABAAiAoOJ/npm9amaZJ/ncwWa2rMDjr82sUfTzGWb2+1DzLGbsk5739+FUHz9Q3hBUlBtmttnMDplZzSLL3zczN7Ozy7CPs6PbVjoF8zvuvt09xd03hR77h668f3MAlAVBRXnzsaRr8x6Y2Y8kJcZuOrFxKr4hAHBqEVSUN7MlDSrw+HpJswpuYGa9zOw9M9trZlvN7P4Cq1+P/nd39PZrl+ht2TfNbLKZ7TGz9WbWo7jBzayCmd1nZlvM7L9mNsvMzihp38U8382scYFFNc3sZTPbZ2avmVmDEsbNu/odYmafSHoluryzmS03s91m9oGZXVDsWYtse6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xsQVxc3LM1atSYmJmZ+b3+zurzzz//9MKFCycef8vvJi0t7cG8Y61YseL8KlWqPHnBBRdcc+DAgR/Ev/N9+vTpUalSpediPY/S/CBONIDYqFOnzvtLly4d9MILLwzNyMiY/cEHH/TKyMi4ccSIEdlnnnnmpmefffbios9ZtWpVlS1btnTq3r37yyc77nvvvVdHkp544omVP/vZz3bXq1fvUEnbXnXVVZOXLl066Kmnnvpt7dq1P542bdrdY8aMaVbS9qG1atXqQJs2bYr79a/gmjdvvmTp0qWDnnvuuVu6d+/+t9dee+26yy+//KrvY2zohP+WLwC4u/v111/vvXr1KrQsMzPT09LS3N39scce8+TkZN+3b1+hbR599FFPSUnxr7/+usR9r1mzxnv06OEJCQl+5pln+vXXX++7d+92d/fRo0e7In8IIv+jJJJ87ty5+Y8PHTrkSUlJPnLkyPxlWVlZ3qJFC69cubI3adLEJ06c6EeOHCm0j6eeesp/+ctfelJSkjds2NBnz55daJwHHnjAzzrrLI+Pj/fU1FQfOHBgiefp4MGDfuedd3rt2rW9cuXK3qlTJ3/jjTfy1//zn/90Sb5kyRLv2LGjJyYmert27fydd94p8Tjd3X/605/67bffXmjZRRdd5J07d3Z39507d3q/fv28bt26npCQ4C1btvSsrKz8bWfOnOnVq1f3gwcPFtpH//79/YorrnD3yLk/99xzfcaMGd6gQQNPTk72wYMHe05Ojj/++ONer149r169ug8bNqzQOczJyfG77rrL69at60lJSd6+fXtfvHhxmY85b33Bj9GjR5d6PgIrUyMJKoCTUlxQf/3rX3uNGjXc3X3Xrl2ekJDgU6dOLbRN69atPTMzs8T97t+/39PT0z0jI8PXrFnjr776qjdp0sSvvvpqd3fft2+fP/300y7JP/vsM//ss89K3FfRoLq7V61a1YcPH+7u7lOmTPG0tDSfO3eub9q0yRcsWOCpqak+efLkQvuoW7euz5492zdu3OgjR470uLg437x5s7u7z5s3z6tUqeILFy70LVu2+OrVqws9v+h5uuOOOzwtLc0XLlzoH330kWdmZnpycrJv377d3b+NR4cOHfyVV17xdevW+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EAABBUAgAAIKgAAARBUAAACIKgAAARAUAEACICgAgAQAEEFACAAggoAQAAEFQCAAAgqAAABEFQAAAIgqAAABFCpyOOrJKXGYiKSpI4dYzY0AADfRdGgpkr6NBYTkSTt3RuzoQEA+C645QsAQAAEFQCAAIre8o2ttLRYzwAAgJNSvoJ6ySWxngEAACelTLd8mzVrdqeZLTAzxcXFqVGjRhoxYoT279+vzZs3y8zyPypXrqymTZtq/Pjxx+xn9+7dGjFihBo1aqT4+HjVrl1b/fr10/r164MfGAAA36cyX6HWqVPn/Xffffe83NxcvfHGG8rMzNT+/ft19913S5IWL16sNm3aKCcnR6+88opuuukm1a9fX3379pUk7dq1S127dpUkTZo0SW3atNH27ds1duxYdejQQa+88oo6dOhwCg4RAIBTz9y94ONbVMyvzTRr1uzOAwcOVN26dWt+8YYOHaqFCxdqxYoVatiwoVavXq327dvnP6d9+/bq0aOHHn74YUnSbbfdppkzZ2rjxo1KT0/P3+7o0aNq3769Dh06pLVr18rMwh8lAAAnr0xhOulX+SYmJio3N/eY5e6uN998U+vWrVOnTp0kRaL55z//WQMGDCgUU0mqUKGChg8frg8//FBr1qw52ekAABBTJ/WipFWrVmnOnDnq0aNH/rLu3burQoUKOnTokHJzc/Wb3/xGV199tSTpiy++0K5du9SiRYti99eyZUtJ0oYNG9SmTZuTmRIAADFV5qB++umn7VJSUnT48GHl5uYqIyNDkydP1oEDByRJc+bMUatWrZSbm6u1a9fqjjvuUHJysn7/+9/n76Ok27l5t5253QsAOF2VOaipqan/euONN1rHxcUpPT1dcXFxkqTNmzdLkurVq6fGjRtLklq0aKFNmzbpd7/7ne677z7VqlVL1apV04cffljsvtetWydJatKkyXc5FgAAYqbMP0OtVKlSTuPGjdWgQYP8mJamYsWKOnz4sA4dOqQKFSqoX79+mjNnjrZv315ou6NHj2rChAk699xzud0LADhtBfvTg19++aV27Nihbdu2adGiRZo0aZIuvPBCVa1aVZI0duxY1a1bVxdddJH+9re/aevWrVq5cqWuvPJKbdy4UdOnT+eWLwDgtHWiL0rqXXTBO++8U1vS1EsvvVSSZGZHExISvmrYsOE7Y8aMmS1pryRVr15dc+bMSbnpppv69uvXr/M333xTIy4u7kC9evXWPProo3M6dOiwrYQx60p68gTnCQDA96pMv4caYwQVAFDu8W4zAAAEQFABAAiAoAIAEABBBQAgAIIKAEAARX9t5nNFXlVbnnwe6wkAAHA8RX9tBgAAnARu+QIAEABBBQAggP8PkBV5iAcozuAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 576x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import matplotlib.dates as mdates\n",
    "\n",
    "\n",
    "names = [\"PBO\",\"PV of Pension Payment\"]\n",
    "\n",
    "dates = ['1','2']\n",
    "\n",
    "levels = np.array([-5, 5, -3, 3, -1, 1])\n",
    "fig, ax = plt.subplots(figsize=(8, 5))\n",
    "\n",
    "# Create the base line\n",
    "start = min(dates)\n",
    "stop = max(dates)\n",
    "ax.plot((start, stop), (0, 0), 'k', alpha=.5)\n",
    "\n",
    "# Iterate through releases annotating each one\n",
    "for ii, (iname, idate) in enumerate(zip(names, dates)):\n",
    "    level = levels[ii % 6]\n",
    "    vert = 'top' if level < 0 else 'bottom'\n",
    "\n",
    "    ax.scatter(idate, 0, s=100, facecolor='w', edgecolor='k', zorder=9999)\n",
    "    # Plot a line up to the text\n",
    "    ax.plot((idate, idate), (0, level), c='r', alpha=.7)\n",
    "    # Give the text a faint background and align it properly\n",
    "    ax.text(idate, level, iname,\n",
    "            horizontalalignment='right', verticalalignment=vert, fontsize=14,\n",
    "            backgroundcolor=(1., 1., 1., .3))\n",
    "ax.set(title=\"Matplotlib release dates\")\n",
    "# Set the xticks formatting\n",
    "# format xaxis with 3 month intervals\n",
    "ax.get_xaxis().set_major_locator(mdates.MonthLocator(interval=3))\n",
    "ax.get_xaxis().set_major_formatter(mdates.DateFormatter(\"%b %Y\"))\n",
    "fig.autofmt_xdate()\n",
    "\n",
    "# Remove components for a cleaner look\n",
    "plt.setp((ax.get_yticklabels() + ax.get_yticklines() +\n",
    "          list(ax.spines.values())), visible=False)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPQAAADuCAYAAAAOYioDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJztnXlc1NX+/1+fGWBAYABF3BE0BQS3KyGZC27ZoqYZ6rXQvNo301yzBEsz6ydoejW95fVW3tTqZrZnpqZBbqEioCxKLiibyM6wDcxyfn+cYBhmgBmY7fPhPB+Pz0PmzOdzzpk5vuZs7/N+c4QQMBgMYSCydgUYDIbpYIJmMAQEEzSDISCYoBkMAcEEzWAICCZoBkNAMEEzGAKCCZrBEBBM0AyGgLAz5mZPT0/i4+NjpqowGIzmuHLlShEhpGtr9xklaB8fHyQkJLS9VgwGo01wHHfPkPvYkJvBEBBM0AyGgGCCZjAEBBM0gyEgmKAZDAHBBM1gCAgmaAZDQDBBMxgCggmawRAQTNAMhoBggmYwBAQTNIMhIJigGQwBwQTNYAgIJmgGQ0AwQTMYAoIJmsEQEEzQDIaAYIJmMAQEEzSDISCYoBkMAcEEzWAICCZoBkNAMEEzGAKCCZrBEBBM0AyGgGCCZjAEBBM0gyEgmKAZDAHBBM1gCAgmaAZDQHQcQS9cCHCc7nX7trVr1qE4deoUOI6z+HXkyBFrf3SL0DEEnZAAHDig/72rVy1blw7OpUuXrFJucHCwVcq1NB1D0CtXAoTofy852bJ16eBYQ9BdunSBr6+vxcu1BnbWroDZ+fxz4MKF5t9nPbRF6dWrF2bNm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xTTGuPriKO6V3tJ4JHxRukKcThnmIj6eXWEyH0P7+Gs8pxcXUd/gd7SZDeLhhnk5sASboNiIRa85Kq4gKqQWpSC1IbfZ+qUSKt8PexvKQ5WYzKGG0jKTR8XaVCkhNpVdzSKXA228Dy5fzJzImLw1LbIX0wnScvnMaF3MvIr0wHVnlWZDVysBxHFwdXNHTtSeGdR+GSf0mYVbALDg7tMFYmWFS0tOB06epAUp6Ot0mk8noeW5XV6BnT2DYMLodNmtW2+zLzYGgLcUYjI6GoC3FGAyGfpigGQwBwQTNYAgIJmgGQ0AwQTMYAoIJmsEQEEzQDIaAYIJmMAQEEzSDISCYoBkMAcEEzWAICCZoBkNAMEEzGAKCCZrBEBBM0AyGgGCCZjAEBBM0gyEgmKAZDAHBBM1gCAgmaAZDQDBBMxgCggmawRAQTNAMhoBggmYwBAQTNIMhIJigGQwBwQTNYAgIJmgGQ0AwQTMYAoIJmsEQEEzQDIaAYIJmMASEUQHfOY4rBHDPfNVhMBjN0JcQ0rW1m4wSNIPBsG3YkJvBEBBM0AyGgGCCZjAEBBM0gyEgmKAZDAHBBM1gCAgmaAZDQDBBMxgCggmawRAQ/x8oxk8AWs0tiwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA',\n",
    "                  'r6': 'AC', 'r7': 'GT', 'r8': 'TG', 'r9': 'CT', 'r10': 'TC',\n",
    "                  'r11': 'GC', 'r12': 'CG'}\n",
    "numbered_bases_to_rates = {v: k for k, v in rates_to_bases.items()}\n",
    "lettered_bases_to_rates = {v: 'r' + v for k, v in rates_to_bases.items()}\n",
    "\n",
    "\n",
    "def make_arrow_plot(data, size=4, display='length', shape='right',\n",
    "                    max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5,\n",
    "                    normalize_data=False, ec=None, labelcolor=None,\n",
    "                    head_starts_at_zero=True,\n",
    "                    rate_labels=lettered_bases_to_rates,\n",
    "                    **kwargs):\n",
    "    \"\"\"Makes an arrow plot.\n",
    "\n",
    "    Parameters:\n",
    "\n",
    "    data: dict with probabilities for the bases and pair transitions.\n",
    "    size: size of the graph in inches.\n",
    "    display: 'length', 'width', or 'alpha' for arrow property to change.\n",
    "    shape: 'full', 'left', or 'right' for full or half arrows.\n",
    "    max_arrow_width: maximum width of an arrow, data coordinates.\n",
    "    arrow_sep: separation between arrows in a pair, data coordinates.\n",
    "    alpha: maximum opacity of arrows, default 0.8.\n",
    "\n",
    "    **kwargs can be anything allowed by a Arrow object, e.g.\n",
    "    linewidth and edgecolor.\n",
    "    \"\"\"\n",
    "\n",
    "    plt.xlim(-0.5, 1.5)\n",
    "    plt.ylim(-0.5, 1.5)\n",
    "    plt.gcf().set_size_inches(size, size)\n",
    "    plt.xticks([])\n",
    "    plt.yticks([])\n",
    "    max_text_size = size * 12\n",
    "    min_text_size = size\n",
    "    label_text_size = size * 2.5\n",
    "    text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif',\n",
    "                   'fontweight': 'bold'}\n",
    "    r2 = np.sqrt(2)\n",
    "\n",
    "    deltas = {\n",
    "        'AT': (1, 0),\n",
    "        'TA': (-1, 0),\n",
    "        'GA': (0, 1),\n",
    "        'AG': (0, -1),\n",
    "        'CA': (-1 / r2, 1 / r2),\n",
    "        'AC': (1 / r2, -1 / r2),\n",
    "        'GT': (1 / r2, 1 / r2),\n",
    "        'TG': (-1 / r2, -1 / r2),\n",
    "        'CT': (0, 1),\n",
    "        'TC': (0, -1),\n",
    "        'GC': (1, 0),\n",
    "        'CG': (-1, 0)}\n",
    "\n",
    "    colors = {\n",
    "        'AT': 'r',\n",
    "        'TA': 'k',\n",
    "        'GA': 'g',\n",
    "        'AG': 'r',\n",
    "        'CA': 'b',\n",
    "        'AC': 'r',\n",
    "        'GT': 'g',\n",
    "        'TG': 'k',\n",
    "        'CT': 'b',\n",
    "        'TC': 'k',\n",
    "        'GC': 'g',\n",
    "        'CG': 'b'}\n",
    "\n",
    "    label_positions = {\n",
    "        'AT': 'center',\n",
    "        'TA': 'center',\n",
    "        'GA': 'center',\n",
    "        'AG': 'center',\n",
    "        'CA': 'left',\n",
    "        'AC': 'left',\n",
    "        'GT': 'left',\n",
    "        'TG': 'left',\n",
    "        'CT': 'center',\n",
    "        'TC': 'center',\n",
    "        'GC': 'center',\n",
    "        'CG': 'center'}\n",
    "\n",
    "    def do_fontsize(k):\n",
    "        return float(np.clip(max_text_size * np.sqrt(data[k]),\n",
    "                             min_text_size, max_text_size))\n",
    "\n",
    "    A = plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'),\n",
    "                 **text_params)\n",
    "    T = plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'),\n",
    "                 **text_params)\n",
    "    G = plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'),\n",
    "                 **text_params)\n",
    "    C = plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'),\n",
    "                 **text_params)\n",
    "\n",
    "    arrow_h_offset = 0.25  # data coordinates, empirically determined\n",
    "    max_arrow_length = 1 - 2 * arrow_h_offset\n",
    "    max_head_width = 2.5 * max_arrow_width\n",
    "    max_head_length = 2 * max_arrow_width\n",
    "    arrow_params = {'length_includes_head': True, 'shape': shape,\n",
    "                    'head_starts_at_zero': head_starts_at_zero}\n",
    "    ax = plt.gca()\n",
    "    sf = 0.6  # max arrow size represents this in data coords\n",
    "\n",
    "    d = (r2 / 2 + arrow_h_offset - 0.5) / r2  # distance for diags\n",
    "    r2v = arrow_sep / r2  # offset for diags\n",
    "\n",
    "    # tuple of x, y for start position\n",
    "    positions = {\n",
    "        'AT': (arrow_h_offset, 1 + arrow_sep),\n",
    "        'TA': (1 - arrow_h_offset, 1 - arrow_sep),\n",
    "        'GA': (-arrow_sep, arrow_h_offset),\n",
    "        'AG': (arrow_sep, 1 - arrow_h_offset),\n",
    "        'CA': (1 - d - r2v, d - r2v),\n",
    "        'AC': (d + r2v, 1 - d + r2v),\n",
    "        'GT': (d - r2v, d + r2v),\n",
    "        'TG': (1 - d + r2v, 1 - d - r2v),\n",
    "        'CT': (1 - arrow_sep, arrow_h_offset),\n",
    "        'TC': (1 + arrow_sep, 1 - arrow_h_offset),\n",
    "        'GC': (arrow_h_offset, arrow_sep),\n",
    "        'CG': (1 - arrow_h_offset, -arrow_sep)}\n",
    "\n",
    "    if normalize_data:\n",
    "        # find maximum value for rates, i.e. where keys are 2 chars long\n",
    "        max_val = 0\n",
    "        for k, v in data.items():\n",
    "            if len(k) == 2:\n",
    "                max_val = max(max_val, v)\n",
    "        # divide rates by max val, multiply by arrow scale factor\n",
    "        for k, v in data.items():\n",
    "            data[k] = v / max_val * sf\n",
    "\n",
    "    def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):\n",
    "        # set the length of the arrow\n",
    "        if display == 'length':\n",
    "            length = max_head_length + data[pair] / sf * (max_arrow_length -\n",
    "                                                          max_head_length)\n",
    "        else:\n",
    "            length = max_arrow_length\n",
    "        # set the transparency of the arrow\n",
    "        if display == 'alpha':\n",
    "            alpha = min(data[pair] / sf, alpha)\n",
    "\n",
    "        # set the width of the arrow\n",
    "        if display == 'width':\n",
    "            scale = data[pair] / sf\n",
    "            width = max_arrow_width * scale\n",
    "            head_width = max_head_width * scale\n",
    "            head_length = max_head_length * scale\n",
    "        else:\n",
    "            width = max_arrow_width\n",
    "            head_width = max_head_width\n",
    "            head_length = max_head_length\n",
    "\n",
    "        fc = colors[pair]\n",
    "        ec = ec or fc\n",
    "\n",
    "        x_scale, y_scale = deltas[pair]\n",
    "        x_pos, y_pos = positions[pair]\n",
    "        plt.arrow(x_pos, y_pos, x_scale * length, y_scale * length,\n",
    "                  fc=fc, ec=ec, alpha=alpha, width=width,\n",
    "                  head_width=head_width, head_length=head_length,\n",
    "                  **arrow_params)\n",
    "\n",
    "        # figure out coordinates for text\n",
    "        # if drawing relative to base: x and y are same as for arrow\n",
    "        # dx and dy are one arrow width left and up\n",
    "        # need to rotate based on direction of arrow, use x_scale and y_scale\n",
    "        # as sin x and cos x?\n",
    "        sx, cx = y_scale, x_scale\n",
    "\n",
    "        where = label_positions[pair]\n",
    "        if where == 'left':\n",
    "            orig_position = 3 * np.array([[max_arrow_width, max_arrow_width]])\n",
    "        elif where == 'absolute':\n",
    "            orig_position = np.array([[max_arrow_length / 2.0,\n",
    "                                       3 * max_arrow_width]])\n",
    "        elif where == 'right':\n",
    "            orig_position = np.array([[length - 3 * max_arrow_width,\n",
    "                                       3 * max_arrow_width]])\n",
    "        elif where == 'center':\n",
    "            orig_position = np.array([[length / 2.0, 3 * max_arrow_width]])\n",
    "        else:\n",
    "            raise ValueError(\"Got unknown position parameter %s\" % where)\n",
    "\n",
    "        M = np.array([[cx, sx], [-sx, cx]])\n",
    "        coords = np.dot(orig_position, M) + [[x_pos, y_pos]]\n",
    "        x, y = np.ravel(coords)\n",
    "        orig_label = rate_labels[pair]\n",
    "        label = r'$%s_{_{\\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])\n",
    "\n",
    "        plt.text(x, y, label, size=label_text_size, ha='center', va='center',\n",
    "                 color=labelcolor or fc)\n",
    "\n",
    "    for p in sorted(positions):\n",
    "        draw_arrow(p)\n",
    "\n",
    "\n",
    "# test data\n",
    "all_on_max = dict([(i, 1) for i in 'TCAG'] +\n",
    "                  [(i + j, 0.6) for i in 'TCAG' for j in 'TCAG'])\n",
    "\n",
    "realistic_data = {\n",
    "    'A': 0.4,\n",
    "    'T': 0.3,\n",
    "    'G': 0.5,\n",
    "    'C': 0.2,\n",
    "    'AT': 0.4,\n",
    "    'AC': 0.3,\n",
    "    'AG': 0.2,\n",
    "    'TA': 0.2,\n",
    "    'TC': 0.3,\n",
    "    'TG': 0.4,\n",
    "    'CT': 0.2,\n",
    "    'CG': 0.3,\n",
    "    'CA': 0.2,\n",
    "    'GA': 0.1,\n",
    "    'GT': 0.4,\n",
    "    'GC': 0.1}\n",
    "\n",
    "extreme_data = {\n",
    "    'A': 0.75,\n",
    "    'T': 0.10,\n",
    "    'G': 0.10,\n",
    "    'C': 0.05,\n",
    "    'AT': 0.6,\n",
    "    'AC': 0.3,\n",
    "    'AG': 0.1,\n",
    "    'TA': 0.02,\n",
    "    'TC': 0.3,\n",
    "    'TG': 0.01,\n",
    "    'CT': 0.2,\n",
    "    'CG': 0.5,\n",
    "    'CA': 0.2,\n",
    "    'GA': 0.1,\n",
    "    'GT': 0.4,\n",
    "    'GC': 0.2}\n",
    "\n",
    "sample_data = {\n",
    "    'A': 0.2137,\n",
    "    'T': 0.3541,\n",
    "    'G': 0.1946,\n",
    "    'C': 0.2376,\n",
    "    'AT': 0.0228,\n",
    "    'AC': 0.0684,\n",
    "    'AG': 0.2056,\n",
    "    'TA': 0.0315,\n",
    "    'TC': 0.0629,\n",
    "    'TG': 0.0315,\n",
    "    'CT': 0.1355,\n",
    "    'CG': 0.0401,\n",
    "    'CA': 0.0703,\n",
    "    'GA': 0.1824,\n",
    "    'GT': 0.0387,\n",
    "    'GC': 0.1106}\n",
    "\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    from sys import argv\n",
    "    d = None\n",
    "    if len(argv) > 1:\n",
    "        if argv[1] == 'full':\n",
    "            d = all_on_max\n",
    "            scaled = False\n",
    "        elif argv[1] == 'extreme':\n",
    "            d = extreme_data\n",
    "            scaled = False\n",
    "        elif argv[1] == 'realistic':\n",
    "            d = realistic_data\n",
    "            scaled = False\n",
    "        elif argv[1] == 'sample':\n",
    "            d = sample_data\n",
    "            scaled = True\n",
    "    if d is None:\n",
    "        d = all_on_max\n",
    "        scaled = False\n",
    "    if len(argv) > 2:\n",
    "        display = argv[2]\n",
    "    else:\n",
    "        display = 'length'\n",
    "\n",
    "    size = 4\n",
    "    plt.figure(figsize=(size, size))\n",
    "\n",
    "    make_arrow_plot(d, display=display, linewidth=0.001, edgecolor=None,\n",
    "                    normalize_data=scaled, head_starts_at_zero=True, size=size)\n",
    "\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
